package com.study.day01;

import org.apache.http.HttpHost;
import org.elasticsearch.action.admin.indices.create.CreateIndexRequest;
import org.elasticsearch.action.admin.indices.create.CreateIndexResponse;
import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.client.indices.GetIndexRequest;
import org.elasticsearch.client.indices.GetIndexResponse;

import java.io.IOException;

public class ESTest_Index_Search {

    public static void main(String[] args) throws IOException {

        RestHighLevelClient esClient = new RestHighLevelClient(
                RestClient.builder(new HttpHost("localhost",9200,"http"))
        );

        GetIndexRequest user = new GetIndexRequest("user");
        GetIndexResponse getIndexResponse = esClient.indices().get(user, RequestOptions.DEFAULT);


        System.out.println(getIndexResponse.getAliases());

        System.out.println(getIndexResponse.getMappings());

        System.out.println(getIndexResponse.getSettings());

        try {
            esClient.close();
        } catch (IOException e) {
            e.printStackTrace();
        }


    }

}
